package cn.com.connext.scrm.repository.master;

import cn.com.connext.scrm.domain.master.Prize;
import cn.com.connext.scrm.domain.master.PrizeCode;
import com.connext.common.util.date.DateTime;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 2 * @Author: shawn
 * 3 * @Date: 2020/8/11 4:14 下午
 * 4
 */
@Repository
public interface PrizeCodeRepository extends JpaRepository<PrizeCode, Integer>, JpaSpecificationExecutor {
    //@Query(value = "select * from prize_code where  activity_id = :activityId and union_id= :unionId  and prize_good_id = :prizeGoodId and create_time = :createTime", nativeQuery = true)
    PrizeCode findByActivityIdAndUnionIdAndPrizeGoodIdAndCreateTime(@Param("activityId")String activityId, @Param("unionId")String unionId, @Param("prizeGoodId")Integer prizeGoodId, @Param("createTime") DateTime createTime);

    PrizeCode findByPrizeId(@Param("prizeId")Integer prizeId);

//    PrizeCode (String activityId, String unionId, Integer prizeGoodId, DateTime date);
}
